home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / pi_netrw.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  8.1 KB  |  237 lines

  1. *pi_netrw.txt*  For Vim version 6.0.  Last change: 2001 Sep 17
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Charles E. Campbell, Jr.
  5.  
  6. *http* *scp* *rcp*
  7.  
  8. Network-Oriented File Transfers with Vim    *netrw* *netrw.vim* *network*
  9. 1. Network-Oriented File Transfer            |netrw-xfer|
  10. 2. Activation                        |netrw-activate|
  11. 3. Ex Commands                        |netrw-ex|
  12. 4. Variables                        |netrw-var|
  13. 5. User Options                        |netrw-options|
  14.  
  15. The functionality mentioned here is done via using |standard-plugin|
  16. techniques.  This plugin is only available if 'compatible' is not set and you
  17. can avoid loading this plugin by setting the "loaded_netrw" variable: >
  18.     :let loaded_netrw = 1
  19.  
  20. {Vi does not have any of this}
  21.  
  22.  
  23. ==============================================================================
  24. 1. Network-Oriented File Transfer            *netrw-xfer*
  25.  
  26. Network-oriented file transfer under Vim is implemented by a VimL-based script
  27. (<netrw.vim>) using plugin techniques.  It currently supports both reading
  28. and writing across networks using rcp, scp, ftp, or ftp+<.netrc> as
  29. appropriate.  http is currently supported read-only.
  30.  
  31. For rcp, scp, and http, one can use network-oriented file transfer
  32. transparently:
  33. >
  34.     vim rcp://machine/path
  35.     vim scp://machine/path
  36. <
  37. If your ftp supports <.netrc>, then it too can be just as transparently used
  38. if the needed triad of machine name, user id, and password are present in that
  39. file.  Your ftp must be able to use the <.netrc> file on its own, however.
  40. >
  41.     vim ftp://machine/path
  42. <
  43. However, ftp will often need to query the user for the userid and
  44. password.  The latter will be done "silently"; ie asterisks will show up
  45. instead of the actually-typed-in password.  Netrw will retain the userid and
  46. password for subsequent read/writes from the most recent transfer so
  47. subsequent transfers (read/write) to or from that machine will take place
  48. without additional prompting.
  49.  
  50.       Reading               Writing              Uses~
  51.       ------------------------       ---------------------------      ----------
  52. >
  53.     * rcp://machine/path     * rcp://machine/path          rcp
  54. <     :Nread rcp://machine/path       :Nwrite rcp://machine/path      rcp
  55. >
  56.     * scp://machine/path     * scp://machine/path          scp
  57. <     :Nread scp://machine/path       :Nwrite scp://machine/path      scp (**)
  58. >
  59.     * ftp://machine/path     * ftp://machine/path          ftp
  60. <     :Nread ftp://machine/path       :Nwrite ftp://machine/path      ftp+(***)
  61.       :Nread machine path       :Nwrite machine path          ftp+.netrc
  62.       :Nread machine uid pass path :Nwrite machine uid pass path  ftp
  63.  
  64.       (for ftp, "machine" may be machine#port if a different port is needed
  65.       than the standard ftp port)
  66. >
  67.     * http://machine/path                      wget
  68. <     :Nread http://machine/path                  wget
  69.  
  70.     (*) transparent file transfer: i.e. vim rcp://machine/path
  71.                         :r    ftp://machine/path
  72.                         :w    ftp://machine/path
  73.  
  74.     (**) For an absolute path use scp://machine//path.
  75.  
  76.     (***) if <.netrc> is present, it is assumed that it will
  77.          work with your ftp client.  Otherwise the script will
  78.          prompt for user-id and pasword.
  79.     
  80. Both the :Nread and the :Nwrite ex-commands can accept multiple filenames: >
  81.  
  82.     :Nread rcp://machine/path1 rcp://machine/path2
  83. >
  84.  
  85. NETRC                            *netrw-netrc*
  86.  
  87. The typical syntax for lines in a <.netrc> file is given as shown below.
  88. Unix ftp's usually support <.netrc>; Windows ftp's usually don't.
  89. >
  90.     machine {full machine name} login {user-id} password "{password}"
  91.     default                login {user-id} password "{password}"
  92.  
  93. Your ftp client must handle the use of <.netrc> on its own, but if the
  94. <.netrc> file exists, an ftp transfer will not ask for the user-id or
  95. password.
  96.  
  97.     Note:
  98.     Since this file contains passwords, make very sure nobody else can
  99.     read this file!  Most programs will refuse to use a .netrc that is
  100.     readable for others.  Don't forget that the system administrator can
  101.     still read the file!
  102.  
  103.  
  104. PASSWORD                        *netrw-passwd*
  105.  
  106. The script attempts to get passwords for ftp invisibly using |inputsecret()|,
  107. a built-in Vim function.  See |netrw-uidpass| for how to change the password
  108. after one has set it.
  109.  
  110.  
  111. ==============================================================================
  112. 2. Activation                        *netrw-activate*
  113.  
  114. Network-oriented file transfers are available by default whenever
  115. |'nocompatible'| mode is enabled.  The <netrw.vim> file resides in your
  116. system's vim-plugin directory and is sourced automatically whenever you bring
  117. up vim.
  118.  
  119.  
  120. TRANSPARENT FILE TRANSFER                *netrw-transparent*
  121.  
  122. Transparent file transfers occur whenever a regular file read or write
  123. (invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is
  124. made.  Thus one may use files across networks as if they were local. >
  125.  
  126.     vim ftp://machine/path
  127.     ...
  128.     :wq
  129.  
  130.  
  131. ==============================================================================
  132. 3. Ex Commands                        *netrw-ex*
  133.  
  134. The usual read/write commands are supported.  There are also a couple of
  135. additional commands available.
  136.  
  137. :[range]Nw
  138.                 Write the specified lines to the current
  139.                 file as specified in b:netrw_lastfile.
  140.  
  141. :[range]Nw {netfile} [{netfile}]...
  142.                 Write the specified lines to the {netfile}.
  143.  
  144. :Nread
  145.                 Read the specified lines into the current
  146.                 buffer from the file specified in
  147.                 b:netrw_lastfile.
  148.  
  149. :Nread {netfile} {netfile}...
  150.                 Read the {netfile} after the current line.
  151.  
  152.                                     *netrw-uidpass*
  153. :call NetUserPass()
  154.                 If b:netrw_uid and b:netrw_passwd don't exist,
  155.                 this function query the user for them.
  156.  
  157. :call NetUserPass("userid")
  158.                 This call will set the b:netrw_uid and, if
  159.                 the password doesn't exist, will query the user for it.
  160.  
  161. :call NetUserPass("userid","passwd")
  162.                 This call will set both the b:netrw_uid and b:netrw_passwd.
  163.                 The user-id and password are used by ftp transfers.  One may
  164.                 effectively remove the user-id and password by using ""
  165.                 strings.
  166.  
  167.  
  168. ==============================================================================
  169. 4. Variables                        *netrw-var*
  170.  
  171. The script <netrw.vim> uses several variables:
  172.  
  173.     netrw_uid        Holds current user-id for ftp.
  174.     netrw_passwd        Holds current password for ftp.
  175.     b:netrw_lastfile    Holds latest method/machine/path.
  176.     b:netrw_line        Holds current line number     (during NetWrite)
  177.     b:netrw_column        Holds current cursor position (during NetWrite)
  178.     netrw_ftp        Optional -- see |netrw-options|
  179.  
  180. The script will also make use of the following variables internally,
  181. albeit temporarily.
  182.  
  183.     g:netrw_method        Index indicating rcp/ftp+.netrc/ftp
  184.     g:netrw_machine        Holds machine name parsed from input
  185.     g:netrw_fname           Holds filename being accessed
  186.  
  187.  
  188. ==============================================================================
  189. 5. User Options                        *netrw-options*
  190.  
  191.     Option        Type    Setting        Meaning ~
  192.     ---------        --------    --------------    --------------------------- >
  193.  
  194.     netrw_ftp        variable    =doesn't exist    userid set by "user userid"
  195.                 =0        userid set by "user userid"
  196.                 =1        userid set by "userid"
  197.  
  198.     NetReadFixup    function    =doesn't exist    no change
  199.                 =exists        Allows user to have ftp-read
  200.                         files automatically
  201.                         transformed however they wish
  202. <
  203.  
  204. These options both help with certain ftp's that give trouble otherwise.  In
  205. order to best understand how to use these options if ftp is giving you
  206. troubles, a bit of discussion follows on how netrw does ftp reads.
  207.  
  208. Netrw typically builds up four lines of the following form:
  209. >
  210.     mark-z
  211.     open machine port
  212.     user userid
  213.     password
  214.     get filename tempfile
  215. <
  216. It then passes the four lines through a filter: 'z+1,.!ftp -i [-n] where -i
  217. tells ftp not to be interactive and the option -n means don't use netrc (if
  218. <.netrc> exists it will be used to avoid having to query the user for userid
  219. and password).  The transferred file is put into a temporary file.  The
  220. temporary file is then read into the main editing session window that
  221. requested it and the temporary file deleted.
  222.  
  223. If your ftp doesn't accept the "user" command and immediately just demands a
  224. userid, then put "let netrw_ftp=1" in your <.vimrc>.
  225.  
  226. If your ftp for whatever reason generates unwanted lines (such as AUTH
  227. messages) you may write a NetReadFixup(tmpfile) function:
  228. >
  229.     function! NetReadFixup(tmpfile) endfunction
  230. >
  231. This function will be called if it exists and thus allows you to customize
  232. your reading process.
  233.  
  234.  
  235. ==============================================================================
  236.  vim:tw=78:ts=8:ft=help:norl:
  237.